home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / mlpmodul.sit / MacLogimoPlus Documentation / DEF2 Files / Options.DEF < prev    next >
Encoding:
Modula Definition  |  1990-06-14  |  2.0 KB  |  51 lines  |  [TEXT/PMED]

  1. DEFINITION MODULE Options; (* AKG / LG 26.02.81/ PF 06.06.83 *)
  2.  
  3. (* 13.06.83 added: FileName,nofile,ChangeExtension   PF*)
  4.  
  5.   EXPORT QUALIFIED FileNameAndOptions, GetOption, Termination,
  6.                    FileName, ChangeExtension;
  7.  
  8.   TYPE Termination = (normal, empty, can, nofile, esc);
  9.  
  10.   TYPE FileName = ARRAY [0..39] OF CHAR;      (*** computer dependent **)
  11.  
  12.  
  13.   PROCEDURE FileNameAndOptions
  14.         (VAR default : ARRAY OF CHAR;
  15.          VAR name    : ARRAY OF CHAR;
  16.          VAR term    : Termination; acceptOption: BOOLEAN);
  17.  
  18.     (*Read file name and options from terminal.
  19.       Reads until a <cr>, blank, <can>, <ctrl-y> or <esc> is typed.
  20.       To read the file name a default name can be proposed.
  21.       name returns the read file name.
  22.       term returns the status of the input termination:
  23.           normal : normally terminated
  24.           empty  : normally terminated, but name is empty
  25.           can    : <can> is typed, input line cancelled
  26.           nofile : <ctrl-y> is typed, no file specified, program should proceed.
  27.           esc    : <esc> is typed, no file specified, program should terminate.
  28.       If acceptOption is TRUE, then options preceded by '/' will be accepted.*)
  29.  
  30.   PROCEDURE GetOption(VAR optStr: ARRAY OF CHAR; VAR length: CARDINAL);
  31.  
  32.     (*To be called repeatedly after FileNameAndOptions, until length = 0.
  33.       The characters of the next option are returned in optstr
  34.       (terminated with a 0C character if length <= HIGH(optstr) ). *)
  35.  
  36.   PROCEDURE ChangeExtension
  37.     (VAR filename    : ARRAY OF CHAR;
  38.      VAR newExtension: ARRAY OF CHAR);
  39.     (* given a filename, change its extension to newExtension.
  40.        e.g. from a .MOD filename, build a .OBJ filename, in the format of
  41.        your operating system *)
  42.  
  43.    (* notes: type  FileName  should be used only for variable declarations,
  44.       In procedure declarations, ARRAY OF CHAR should be used. This makes
  45.       live easier.
  46.       type  Filename  should contain the filename in a printable form, but
  47.       this is not specified *)
  48.  
  49. END Options.
  50.  
  51.